#ifndef __RTC_H
#define __RTC_H


#ifdef __cplusplus
extern "C" {
#endif

//Mini STM32开发板
//RTC实时时钟 驱动代码			 
//正点原子@ALIENTEK
//2010/6/6
#include "stm32f1xx_hal.h"

extern struct tm time_now;//保存当前时间
extern unsigned char last_time_day;   //前一天

typedef uint32_t  u32;
typedef uint16_t u16;
typedef uint8_t  u8;
typedef __IO uint32_t  vu32;
typedef __IO uint16_t vu16;
typedef __IO uint8_t  vu8;

//时间结构体
typedef struct 
{
	vu8 hour;
	vu8 min;
	vu8 sec;			
	//公历日月年周
	vu16 w_year;
	vu8  w_month;
	vu8  w_date;
	vu8  week;		 
}_calendar_obj;					 
extern _calendar_obj calendar;	//日历结构体

extern u8 const mon_table[12];	//月份日期数据表
//void Disp_Time(u8 x,u8 y,u8 size);//在制定位置开始显示时间
//void Disp_Week(u8 x,u8 y,u8 size,u8 lang);//在指定位置显示星期
//u8 RTC_Init(void);        //初始化RTC,返回0,失败;1,成功;
u8 Is_Leap_Year(u16 year);//平年,闰年判断
//u8 RTC_Get(void);         //更新时间   
//u8 RTC_Get_Week(u16 year,u8 month,u8 day);
//u8 RTC_Set(u16 syear,u8 smon,u8 sday,u8 hour,u8 min,u8 sec);//设置时间	

//void RTC_Config(void);
//void Time_SetCalendarTime(struct tm t);
int abs1(int a,int b);
//void Calendar_Calculate(void);
int DiffDays(int y1,int m1,int d1,int y2,int m2,int d2);
int Days(int y,int m,int d);
//void DateDifference(u8 daytime,u16 year,u8 month,u8 day);
//void Preinstall_Judge(void);
//char DataTimerYN(int iYear,int iMonth,int iDay,int hour,int minute,int second);
int DateCheck(int iYear,int iMonth,int iDay);
int TimeCheck(int hour,int minute,int second);

#ifdef __cplusplus
}
#endif

#endif


